package com.topsun.framework.common.core.util;

import cn.hutool.core.collection.CollUtil;

import java.util.HashMap;
import java.util.Map;

public class ValidationResult {

    private boolean hasErrors;

    private Map<String,String> errorMsg = new HashMap<>();

    public boolean isHasErrors() {
        return hasErrors;
    }

    public void setHasErrors(boolean hasErrors) {
        this.hasErrors = hasErrors;
    }

    public Map<String, String> getErrorMsg() {
        return errorMsg;
    }

    public String getErrorMessage() {
        return CollUtil.join(errorMsg.values(), ",");
    }

    public void setErrorMsg(Map<String, String> errorMsg) {
        this.errorMsg = errorMsg;
    }

    @Override
    public String toString() {
        return "ValidationResult [hasErrors=" + hasErrors + ", errorMsg="
                + errorMsg + "]";
    }
}
